<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>

<html>
<head>
    <title>登录页</title>
    <%--echart线图、柱状图、饼图等各种图型库 cdn--%>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
    <%--jquery cdn--%>
    <script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
</head>
<body>

欢迎${name} 登录
欢迎 ${nickName} 绑定成功
<img  style="width: 50px;height: 50px" src="${avatarUrl}">
<a href="https://gitee.com/oauth/authorize?client_id=96b8d574dbd606af3c264c89752fd83f54d71e377743d1f6acb5db818ae61713&redirect_uri=http://localhost:8080/callbackCode.do&response_type=code">gitee绑定</a>
<h1>------------------------------</h1>

<form action="/list.do">

    学生 <input name="studentName"> <br>
    宿舍号 <input name="roomName"> <br>
    楼号 <input name="apartmentName"> <br>
    <input type="submit" value="查询">
    <input type="button" value="导出Excel" onclick="excelList()">
    <a href="/addPage.do">入住</a>


    <table>
        <tr>
            <td>宿舍号</td>
            <td>图片</td>
            <td>楼号</td>
            <td>学生</td>
            <td>入住时间</td>
        </tr>

        <c:forEach items="${list}" var="s">
            <tr>
                <td>${s.roomName}</td>
                <td><img style="width: 50px;height: 50px" src="${s.pic}"></td>
                <td>${s.apartmentName}</td>
                <td>${s.studentName}</td>
                <td>${s.createTime}</td>
            </tr>
        </c:forEach>
    </table>

</form>


</body>
<script>


    function excelList() {
        let studentName = $('[name=studentName]').val();
        let roomName = $('[name=roomName]').val();
        let apartmentName = $('[name=apartmentName]').val();
        window.location.href = 'excelList.do?studentName=' + studentName + '&roomName=' + roomName + "&apartmentName=" + apartmentName
    }
</script>
</html>